
<%@ include file="../confHeader.jsp" %>
<%@ include file="../mensagens.jsp" %>
<html>
<head>
	
</head>
<body>  <html:javascript formName="ProdutoForm" />  
		<html:form  action="produtoAction" method="POST"  onsubmit="return true;">           
			<html:hidden property="idEspecProduto" value=""/>
			
		<div class='pageForm'>
            <div class='formTitle'>
  				<bean:message key="produto.list.title"/>
            </div>
            
    		<hr size="1">
            <div class='pageList'>
                <table cellspacing='0'>
                    <tbody>                       

              		${el:defineSearchResult('searchResult', 'to.searcher', 'beanList',  'request', pageContext)}			
                 	<bean:define id="beanList" name="searchResult" property="result" />               
		           <logic:present name="beanList">
			            <logic:empty name="beanList">
				             <tr class='thead'>								 	   
								<bean:message key="app.list.empty"/>
	                        </tr>
			            </logic:empty>
        			      <logic:notEmpty name="beanList"> 
							 <tr class='thead'>								 	   
	                            <td width="30%"><bean:message key="produto.codigo"/>-<bean:message key="produto.nome"/></td>
	                             <td width="30%"><bean:message key="grupo.entity"/></td>
	                             <td width="30%"><bean:message key="subgrupo.entity"/></td>	                          
	                               <td colspan="2"><bean:message key="app.label.actions"/></td>                       
	                        </tr>
							<logic:iterate name='beanList'  id="bean"  indexId="index" >									
 							   <tr class="${(index%2!=0)? 'shade' : ''}" onmouseover="this.className='mouseOver';" onmouseout="this.className='${(index%2!=0)? 'shade' : ''}'" >
	                             <td width="30%"><a href="javascript:detalhar('${bean.idEspecProduto}');">${bean.idEspecProduto}-${el:write('bean.nome',pageContext)} </a></td>
	                             <td width="30%">${el:write('bean.subgrupo.pai.idGrupo',pageContext)} - ${el:write('bean.subgrupo.pai.nome',pageContext)}</td>
	                             <td width="30%">${el:write('bean.subgrupo.idGrupo',pageContext)}  - ${el:write('bean.subgrupo.nome',pageContext)}</td>                                                                
                              	 <td width="1%" align="center"><html:img  onclick="javascript:alterar('${bean.idEspecProduto}');" src='${contexto}/pages/images/editar.gif' titleKey="app.button.update" /></td>
                              	 <td width="1%" align="center"><html:img onclick="javascript:remover('${bean.idEspecProduto}');" src='${contexto}/pages/images/fechar_x.gif' titleKey="app.button.delete" /></td>                                  
    	                        
    	                        </tr>
							</logic:iterate>
						</logic:notEmpty>
					</logic:present>                        
                    </tbody>     
                </table>                  
            </div>
              <app:paging url="${contexto}/produtoAction.do" searchResultName="searchResult" />            
      
          <hr size="1">
          <div class='formButton'>    
         
	  	   <a onclick="javascript:back();" class="linkButton" > <bean:message key="app.button.return"/></a>              	
          </div>                  
       </div> 
                  
      </html:form>           
            
   
      
<script type="text/javascript">
 // <!--
     
 var action= '<html:rewrite page="/produtoAction.do"/>';
  var nForm =  'ProdutoForm';

  function alterar(id){	  
   	 document.forms[nForm].idEspecProduto.value = id;
	 executeForm(nForm, action, 'goAltualizar');
 }
  function detalhar(id){
     document.forms[nForm].idEspecProduto.value = id;
 	 executeForm(nForm, action, 'goDetalhar');
 }
   function remover(id){	
     if(confirm('<bean:message key="app.prompt.confirm.delete"/>\n<bean:message key="msg.04.05"/>')){
	  	  document.forms[nForm].idEspecProduto.value = id;
		 executeForm(nForm, action, 'remover');
	 }
 }
 

  //-->
</script>
</body>
</html>

